From: Shanker Donthineni Date: Mon, 27 Jun 2016 20:33:34 +0000 (-0500) Subject: arm/gic-v3: Do early GICD ioremap and clean up X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~769 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=c35a2934e9264077b0dbc222efed309630c246b9;p=xen.git arm/gic-v3: Do early GICD ioremap and clean up For ACPI based XEN boot, the GICD region needs to be accessed inside the function gicv3_acpi_init() in later patch. There is a duplicate panic() message, one in the DTS probe and second one in the ACPI probe path. For these two reasons, move the code that validates the GICD base address and does the region ioremap to a separate function. The following patch accesses the GICD region inside gicv3_acpi_init() for finding per CPU Redistributor size. Signed-off-by: Shanker Donthineni Acked-by: Julien Grall Acked-by: Stefano Stabellini --- diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 6b06d35c11..8a0d351d8f 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -1164,6 +1164,17 @@ static void __init gicv3_init_v2(void) vgic_v2_setup_hw(dbase, cbase, csize, vbase, 0); } +static void __init gicv3_ioremap_distributor(paddr_t dist_paddr) +{ + if ( dist_paddr & ~PAGE_MASK ) + panic("GICv3: Found unaligned distributor address %"PRIpaddr"", + dbase); + + gicv3.map_dbase = ioremap_nocache(dist_paddr, SZ_64K); + if ( !gicv3.map_dbase ) + panic("GICv3: Failed to ioremap for GIC distributor\n"); +} + static void __init gicv3_dt_init(void) { struct rdist_region *rdist_regs; @@ -1174,9 +1185,7 @@ static void __init gicv3_dt_init(void) if ( res ) panic("GICv3: Cannot find a valid distributor address"); - if ( (dbase & ~PAGE_MASK) ) - panic("GICv3: Found unaligned distributor address %"PRIpaddr"", - dbase); + gicv3_ioremap_distributor(dbase); if ( !dt_property_read_u32(node, "#redistributor-regions", &gicv3.rdist_count) ) @@ -1394,9 +1403,7 @@ static void __init gicv3_acpi_init(void) if ( count <= 0 ) panic("GICv3: No valid GICD entries exists"); - if ( (dbase & ~PAGE_MASK) ) - panic("GICv3: Found unaligned distributor address %"PRIpaddr"", - dbase); + gicv3_ioremap_distributor(dbase); /* Get number of redistributor */ count = acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR, @@ -1465,10 +1472,6 @@ static int __init gicv3_init(void) else gicv3_acpi_init(); - gicv3.map_dbase = ioremap_nocache(dbase, SZ_64K); - if ( !gicv3.map_dbase ) - panic("GICv3: Failed to ioremap for GIC distributor\n"); - reg = readl_relaxed(GICD + GICD_PIDR2) & GIC_PIDR2_ARCH_MASK; if ( reg != GIC_PIDR2_ARCH_GICv3 && reg != GIC_PIDR2_ARCH_GICv4 ) panic("GICv3: no distributor detected\n");